<?php

require_once 'init.inc';

$page = Page::get($par->get('id'));

$pageName = $page->menuName();
$title = $page->title();
$keywords = $page->keywords();
$descr = $page->descr();

$ancestors = new AncestorPages($page->id());
foreach ($ancestors as $p) {
	$path[] = array('name' => $p->menuName(), 'link' => $p->link());
}
$path[] = array('name' => $page->menuName());

$children = new ChildPages($page->id());
$childPages = $children->toArray();

if (is_file($_SERVER['DOCUMENT_ROOT'].'/img/header_images/'.Page::toID($page->id()).'.jpg'))
{
	$headerImage = Page::toID($page->id());
}

$albumsOnPage = query2vector("SELECT album_id FROM albums_to_pages WHERE page_id=".Page::toID($page->id()));

$albums = array();
$allAlbums = new GalleryAlbums;
foreach ($albumsOnPage as $aId)
{
	$albums[] = $allAlbums->get($aId);
}

assignTemplateVars('page','childPages','albums');

display($page->id()=='map'?'map':'page');
?>